{% extends "base.html" %}

{% block title %}File Archives - Archive Audit System{% endblock %}

{% block content %}
<h2>Unstructured Data Archives</h2>

{% if archives %}
<div class="table-responsive">
    <table class="table table-striped table-hover">
        <thead>
            <tr>
                <th>ID</th>
                <th>Original Path</th>
                <th>Archive Date</th>
                <th>Archived By</th>
                <th>Description</th>
                <th>File Count</th>
                <th>Total Size</th>
                <th>Actions</th>
            </tr>
        </thead>
        <tbody>
            {% for archive in archives %}
            <tr>
                <td>{{ archive.id }}</td>
                <td>{{ archive.original_path }}</td>
                <td>{{ archive.archive_date }}</td>
                <td>{{ archive.archived_by }}</td>
                <td>{{ archive.description }}</td>
                <td>{{ archive.file_count }}</td>
                <td>{{ (archive.total_size / 1024)|round(1) }} KB</td>
                <td>
                    <a href="{{ url_for('audit_files', archive_id=archive.id) }}" class="btn btn-sm btn-primary">Browse</a>
                </td>
            </tr>
            {% endfor %}
        </tbody>
    </table>
</div>
{% else %}
<div class="alert alert-info">
    No file archives found. <a href="{{ url_for('archive_files') }}">Archive files</a> to get started.
</div>
{% endif %}

<div class="card mt-4">
    <div class="card-header">
        <h5>About File Archives</h5>
    </div>
    <div class="card-body">
        <p>File archives contain copies of files and directories at the time of archiving.</p>
        <p>Each file is hashed for integrity verification and indexed for searching.</p>
        <p>Click the "Browse" button next to an archive to view its contents.</p>
    </div>
</div>
{% endblock %}
